package com.zkthink.ceres.store.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zkthink.base.R;
import com.zkthink.base.controller.SuperController;
import com.zkthink.base.request.PageParams;
import com.zkthink.ceres.store.dto.ExamineDTO;
import com.zkthink.ceres.store.dto.StorePageDTO;
import com.zkthink.ceres.store.dto.StoreSaveDTO;
import com.zkthink.ceres.store.dto.StoreUpdateDTO;
import com.zkthink.ceres.store.entity.Store;
import com.zkthink.ceres.store.entity.StoreJoin;
import com.zkthink.ceres.store.service.StoreJoinService;
import com.zkthink.ceres.store.service.StoreService;
import com.zkthink.dozer.DozerUtils;
import com.zkthink.log.annotation.SysLog;
import com.zkthink.security.annotation.PreAuth;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;


/**
 * <p>
 * 前端控制器 店铺表
 * </p>
 *
 * @author kellen
 * @date 2020-05-14
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/store")
@Api(value = "Store", tags = "车龙惠店铺")

@AllArgsConstructor
public class StoreController extends
    SuperController<StoreService, Long, Store, StorePageDTO, StoreSaveDTO, StoreUpdateDTO> {


  private StoreService storeService;

   @Autowired
   private StoreJoinService storeJoinService;


  @ApiOperation(value = "店铺列表", notes = "店铺列表")
  @PostMapping("/IPageStore")
  public R IPageStore(@RequestBody PageParams<Store> page) {
    return R.success(storeService.IPageStore(page));
  }

  @ApiOperation(value = "店铺审核")
  @PostMapping(value = "/examineStore")
  public R examineStore(@RequestBody ExamineDTO dto) {
    return storeJoinService.examineStore(dto);
  }

  @ApiOperation(value = "审核列表", notes = "审核列表")
  @PostMapping("/list")
  public R list(@RequestBody PageParams<StoreJoin> page) {
    return R.success(storeJoinService.IPagelist(page));
  }
  @ApiOperation(value = "假删除")
  @GetMapping("/deletStore/{id}")
  public R deletStore(@PathVariable("id") Long id) {
    return R.success(storeJoinService.deletStore(id));
  }

}
